#include <iostream>
using namespace std;
int n, N;

int getsum(int a[])
{
    int sum = 0;
    int last = 0;
    for(int i=0;i<n;i++){
       sum+= (a[i+1]-a[i]) * i;
    }
    sum = sum + (N-a[n])*n;
    return sum;
}

int main()
{
    cin >> n >> N;
    int a[n + 1] = {0};
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    cout<<getsum(a)<<endl;
    return 0;
}